package com.hzw.saas.api.hpc.enums;

import java.util.Objects;

/**
 * 超算账户会员等级
 *
 * @author zzl
 * @since 02/03/2021
 */
public enum HpcAccountLevel {

    MONTH(1, "M", "月度会员"),
    SEASON(2, "S", "季度会员"),
    YEAR(3, "Y", "年度会员"),
    ;
    private final Integer value;
    private final String charValue;
    private final String text;

    HpcAccountLevel(Integer value, String charValue, String text) {
        this.value = value;
        this.charValue = charValue;
        this.text = text;
    }

    public Integer value() {
        return value;
    }

    public String text() {
        return text;
    }

    public String charValue() {
        return charValue;
    }

    public static String text(Integer value) {
        for (HpcAccountLevel hpcAccountLevel : HpcAccountLevel.values()) {
            if (Objects.equals(hpcAccountLevel.value, value)) {
                return hpcAccountLevel.text;
            }
        }
        return null;
    }

    public static HpcAccountLevel instance(Integer value) {
        for (HpcAccountLevel hpcAccountLevel : HpcAccountLevel.values()) {
            if (Objects.equals(hpcAccountLevel.value, value)) {
                return hpcAccountLevel;
            }
        }
        return null;
    }

    public static HpcAccountLevel instance(String charValue) {
        for (HpcAccountLevel hpcAccountLevel : HpcAccountLevel.values()) {
            if (Objects.equals(hpcAccountLevel.charValue, charValue)) {
                return hpcAccountLevel;
            }
        }
        return null;
    }
}
